﻿using System;
using System.ServiceModel;
using Infrastructure;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace HostRole
{
    public class InformationService : IInformationService
    {
        public String GetRoleInfo()
        {
            var instance = RoleEnvironment.CurrentRoleInstance;
            var roleName = instance.Role.Name;
            var instanceId = instance.Id;
            return (String.Format("You are talking to role {0}, instance ID {1}\n.", roleName, instanceId));
        }

        public String GetCommunicationChannel()
        {
            return (string.Format("You are talking via {0}.", OperationContext.Current.Channel.LocalAddress.Uri));
        }
    }
}